package com.finalab.yueqiu.util;

import java.util.Random;

public class SaltUtil {

    public static final String RANDOM_STRING = "1234567890abcdefghijklmnopqrstuvwxyz";

    public static final Random RAMDON = new Random();

    public static final int DEFAuULT_LENGTH = 16;

    public static String getSalt() {
        return getSalt(DEFAuULT_LENGTH);
    }

    public static String getSalt(int length){
        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0;i < length;i++){
            stringBuilder.append(RANDOM_STRING.charAt(RAMDON.nextInt(length)));
        }
        return stringBuilder.toString();
    }
}
